﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="UInvoiceDetail.ascx.cs"
    Inherits="PayRoller.Include.UInvoiceDetail" %>
<style type="text/css">
<!--
.style1 {
	font-size: 20px;
	font-weight: bold;
}

    .tableSumary
    {
        text-align: center;
        font-weight: bolder;
    }
    
    .tableContent
    {
        text-align: center;
    }

    .myTable, .myTable td,.myTable th
    {
        border: 1px solid #000000;
        border-collapse: collapse;
    }
-->
</style>
<table width="770" border="0" cellspacing="1" cellpadding="1" align="center" class="NormalText">
    <tr>
        <td>
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr>
                    <td width="50%">
                        <img runat="server" id="picLogo" src="../images/logo.jpg" width="202" height="78" />
                    </td>
                    <td style="line-height: 130%" width="50%">
                        Golden Bridge Enterprises (Aust) Pty Ltd<br />
                        ABN: 92 112 483 226<br />
                        PO BOX 18323, Collins Street East, VIC 8003<br />
                        Tel: 1300 137 906<br />
                        Fax: 1300 138 916
                    </td>
                </tr>
            </table>
        </td>
    </tr>
    <tr>
        <td height="40">
            <div align="center">
                <p align="center" class="style1">
                    Invoice/Statement</p>
            </div>
        </td>
    </tr>
    <tr>
        <td>
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr>
                    <td>
                        <table width="100%" border="0" cellspacing="1" cellpadding="1">
                            <tr>
                                <td height="22">
                                    ABC P/L:<%=sOrgName%>
                                </td>
                            </tr>
                            <tr>
                                <td height="22">
                                    Attn:<%=sContactPerson%>
                                </td>
                            </tr>
                            <tr>
                                <td height="22">
                                    Address:
                                    <%=sPostalAddress%>
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
                <tr>
                    <td>
                        <table width="100%" border="0" cellspacing="1" cellpadding="1">
                            <tr>
                                <td width="50%">
                                    <table width="100%" border="0" cellspacing="1" cellpadding="1">
                                        <tr>
                                            <td height="22">
                                                Date:<%=sInvoiceDate%>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td height="22">
                                                No:<%=sInvoiceSid%>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td height="22">
                                                Ref:<u><%=OrgSid%>&nbsp;&nbsp;</u>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td height="22">
                                                Tax Invoice for period:<u><%=sInvoiceDate%>&nbsp;&nbsp;</u> to <u>
                                                    <%=sInvoiceToDate%>&nbsp;&nbsp;</u>
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                                <td width="50%" valign="top">
                                    <table width="380" cellpadding="1" cellspacing="1" class="myTable">
                                        <tr>
                                            <th height="24">
                                                Your account summary
                                            </th>
                                        </tr>
                                        <tr>
                                            <td style="line-height: 150%">
                                                Credit Limit:<%=fCreditLimit.ToString("0.00")%><br />
                                                Credit Balance:<%=fCreditBalance.ToString("0.00")%><br />
                                                Total Payable:<%= fClosingBalance.ToString("0.00") %><br />
                                                Credit Available:<%=fCreditAvailable.ToString("0.00")%>
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
                <tr>
                    <td>
                        <table width="100%" border="0" cellspacing="1" cellpadding="1">
                            <tr>
                                <td width="50%">
                                    &nbsp;
                                </td>
                                <td width="50%">
                                    &nbsp;
                                </td>
                            </tr>
                            <tr>
                                <td valign="top">
                                    <table width="90%" cellspacing="1" cellpadding="1" class="myTable">
                                        <tr>
                                            <th colspan="3" height="22">
                                                Opening Balance Breakdown
                                            </th>
                                        </tr>
                                        <tr>
                                            <td height="22">
                                                Previous Balance
                                            </td>
                                            <td>
                                                Payment Received
                                            </td>
                                            <td>
                                                Balance Forword
                                            </td>
                                        </tr>
                                        <%
                                            decimal diffAmount = Convert.ToDecimal(fPreviousBalance - fPaidFromPreviousBalance);
                                        %>
                                        <tr>
                                            <td height="22">
                                                <u>
                                                    <%=fPreviousBalance.ToString("0.00")%></u>
                                            </td>
                                            <td>
                                                <u>
                                                    <%=fPaidFromPreviousBalance.ToString("0.00")%></u>
                                            </td>
                                            <td>
                                                <u>
                                                    <%=diffAmount.ToString("0.00")%></u>
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                                <td valign="top">
                                    <table width="380" cellspacing="1" cellpadding="1" class="myTable">
                                        <tr>
                                            <th height="22">
                                                Payment Information
                                            </th>
                                        </tr>
                                        <tr>
                                            <td height="22">
                                                Invoice Amount:<%=fSumAmount.ToString("0.00")%>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td height="22">
                                                Penalty:<%=fPenalty.ToString("0.00")%>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td height="22">
                                                Late Interest Charges:<%=fInterestCharges.ToString("0.00")%>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td height="22">
                                                Payable:<%=fTotalDue.ToString("0.00")%>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td height="22">
                                                Payment Due On:<%=sInvoiceToDate%>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td height="22">
                                                Payment Method: Direct Debit
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
                <tr>
                    <td>
                        <br />
                        <table width="100%" cellspacing="1" cellpadding="1" class="myTable">
                            <tr>
                                <th height="22">
                                    <div align="center">
                                        Date</div>
                                </th>
                                <th>
                                    <div align="center">
                                        Our Ref.</div>
                                </th>
                                <th>
                                    <div align="center">
                                        Employee Name</div>
                                </th>
                                <th>
                                    <div align="center">
                                        Customer ID</div>
                                </th>
                                <th>
                                    <div align="center">
                                        Net Pay</div>
                                </th>
                                <th>
                                    <div align="center">
                                        Finance Cost</div>
                                </th>
                                <th>
                                    <div align="center">
                                        Amount Charged</div>
                                </th>
                            </tr>
                            <%
                                for (int i = 0; i < dtEmpList.Rows.Count; i++)
                                {
                                    string EmpSid = dtEmpList.Rows[i]["EmpSid"].ToString();
                                    string PaymentDate = string.Empty;
                                    try
                                    {
                                        PaymentDate = Convert.ToDateTime(dtEmpList.Rows[i]["PaymentDate"]).ToString("dd/MM/yyyy");
                                    }
                                    catch
                                    {
                                    }
                                    double Amount = Convert.ToDouble(dtEmpList.Rows[i]["Amount"].ToString());
                                    string OrgEmpSid = dtEmpList.Rows[i]["OrgEmpSid"].ToString();
                                    string EmpName = dtEmpList.Rows[i]["EmpName"].ToString();

                                    double fFinanceCost = Amount * 0.01 * fDailyRate * iInvoiceDueDate;
                                    fCurrentTotal = Amount + fFinanceCost;
                                    fSumNetPay += Amount;
                                    fSumFinanceCost += fFinanceCost;
                                    //fSumAmount += fS1;
                            %>
                            <tr>
                                <td height="22" class="tableContent">
                                    <%=PaymentDate%>
                                </td>
                                <td class="tableContent">
                                    <%=EmpSid%>
                                </td>
                                <td class="tableContent">
                                    <%=EmpName%>
                                </td>
                                <td class="tableContent">
                                    <%=OrgEmpSid%>
                                </td>
                                <td class="tableContent">
                                    <%=Amount.ToString("0.00")%>
                                </td>
                                <td class="tableContent">
                                    <%=fFinanceCost.ToString("0.00")%>
                                </td>
                                <td class="tableContent">
                                    <%=fCurrentTotal.ToString("0.00")%>
                                </td>
                            </tr>
                            <%}%>
                            <tr>
                                <td height="22" class="tableSumary">
                                    Totals
                                </td>
                                <td class="tableSumary">
                                </td>
                                <td class="tableSumary">
                                </td>
                                <td class="tableSumary">
                                </td>
                                <td class="tableSumary">
                                    <%=fSumNetPay.ToString("0.00")%>
                                </td>
                                <td class="tableSumary">
                                    <%=fSumFinanceCost.ToString("0.00")%>
                                </td>
                                <td class="tableSumary">
                                    <%=fSumAmount.ToString("0.00")%>
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
            </table>
        </td>
    </tr>
    <tr>
        <td height="30" align="left">
            <div align="center">
                <a href="#" onclick="window.print();">Print</a>
            </div>
        </td>
    </tr>
</table>
